<?php
	class Miiclass{
		public function build_array_php($array,$name,$path,$uniacid){
			$start = "<?php ";
			$end = " ?>";
			$str = '';
			$content='$'.$name.'='.var_export($array,TRUE).';';
			$save_avatar=MODULE_ROOT.$path;
		    if(!is_dir($save_avatar)){
		        mkdir($save_avatar,0777,true);
		    }//如果不存在该目录则建立目录
		    $filename = $name.'.'.$uniacid.'.php';
		    $res = file_put_contents($save_avatar.$filename,$start.$content.$end);
		    if(!$res){
		    	return 0;
		    }else{
		    	return 1;
		    }
		} 
		public function build_str_php($str,$name,$path,$uniacid){
			$start = "<?php";
			$end = "?>";
			$content = '"'.$str.'";';		
			$save_avatar=MODULE_ROOT.$path;
		    if(!is_dir($save_avatar)){
		        mkdir($save_avatar,0777,true);
		    }//如果不存在该目录则建立目录
		    $filename = $name.'.'.$uniacid.'.php';
		    $res = file_put_contents($save_avatar.$filename,$start.$content.$end);
		}
		//生成订单ID
		public function buildOrderOn(){
			$orderid = '';
			//微擎自带随机函数random
			$orderid = date('YmdHis') . random(8,1);
			return $orderid ;
		}
	}	

?>